<?php

namespace app\admin\model\order;

use think\Model;


class OrderAction extends Model
{

    

    

    // 表名
    protected $table = 'order_action';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'oper_type_text',
        'order_status_text'
    ];
    

    
    public function getOperTypeList()
    {
        return ['user' => __('Oper_type user'), 'admin' => __('Oper_type admin'), 'system' => __('Oper_type system')];
    }

    public function getOrderStatusList()
    {
        return ['0' => __('Order_status 0'), '1' => __('Order_status 1'), '2' => __('Order_status 2'), '3' => __('Order_status 3'), '4' => __('Order_status 4'), '5' => __('Order_status 5')];
    }


    public function getOperTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['oper_type']) ? $data['oper_type'] : '');
        $list = $this->getOperTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getOrderStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['order_status']) ? $data['order_status'] : '');
        $list = $this->getOrderStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
